{% load filetransfers %}
{% block title %}Upload file to Blobstore{% endblock %}

{% block content %}
<h1>Upload</h1>
<form action="{{ upload_url }}" method="POST" enctype="multipart/form-data">
  {% csrf_token %}
  {% render_upload_data upload_data %}
  <table>{{ form }}</table>
  <input type="submit" value="Upload" />
</form>

<h1>Files</h1>
<ul>
  {% for upload in uploads %}
    <li>
      {% url wikiproduct.views.download_handler pk=upload.pk as fallback_url %}
      <a href="{% firstof upload.file|public_download_url fallback_url %}">{% firstof upload.title 'unnamed' %} - {{ upload.filename }}</a>
      ({{ upload.file.size|filesizeformat }})
      <form method="post" action="{% url wikiproduct.views.delete_handler pk=upload.pk %}" style="display:inline">
        {% csrf_token %}
        <input type="submit" value="Delete" />
      </form>
    </li>
  {% endfor %}
</ul>
{% endblock %}
</html>